package bishi;

import java.util.HashMap;

/**
 * @Author liuhaoqi
 * @Date 2021/1/26 15:32
 * @Version 1.0
 */
public class Test5 {
    public static void main(String[] args) {
        int[] arr = {1, 1, 2, 2, 3, 3, 5};
        System.out.println(getOneNum(arr));
    }

    public static int getOneNum(int[] arr){
        HashMap<Integer, Integer> map = new HashMap<>();
        int ans = 0;
        for (int num : arr) {
            map.put(num, map.getOrDefault(num, 0) + 1);
        }
        for (int key : map.keySet()) {
            if (map.get(key) == 1) {
                ans = key;
            }
        }
        return ans;
    }
}
